/**
 * 
 */
package com.EstateManager.Test;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.EstateManager.Dao.AdminDao;
import com.EstateManager.Dao.UserDao;
import com.EstateManager.Entity.Admin;
import com.EstateManager.Entity.User;

/**
 * 创建时间 : 上午11:30:25
 * @author Yonggang Liu
 *
 * MainTest.java
 */
@Repository("mainTest")
public class MainTest {
	
	@Autowired
	AdminDao adminDao;
	public void adminDaoSaveTest() {
		Admin admin = new Admin();
		admin.setId(null);
		admin.setCardNo("510682199307110430");
		admin.setPassword("201245");
		admin.setRealName("刘用刚");
		admin.setSex("男");
		admin.setTel("15885021025");
		admin.setUsername("king");
		admin.setWeight(8);
		adminDao.save(admin);
		
		
	}
	@Autowired
	UserDao userDao;
	public void userDaoSaveTest() {
		User user = new User();
		user.setId(null);
		user.setCardNo("510682199307110430");
		user.setPassword("201245");
		user.setRealName("刘用刚");
		user.setSex("男");
		user.setTel("15885021025");
		user.setUsername("king");
		
		System.out.println(userDao.save(user));		
		
	}
	public void adminDaoGetTest(){
		Admin admin =  adminDao.get(3);
		System.out.println(admin.getRealName());
	}
	public User userDaoGetTest(int id){
		User user =  userDao.get(id);
		System.out.println(user.getRealName());
		return user;
	}
}
